package com.offcn;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Update {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //加载驱动
        Class.forName("com.mysql.jdbc.Driver");
        //创建链接

        Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/myschool", "root", "root");
        //创建sql执行平台

        Statement stmt = conn.createStatement();
        //执行sql语句
        String sql = "update accou set blace=20000 where id=1";
        int num = stmt.executeUpdate(sql);
        //处理结果
        if (num>0){
            System.out.println("修改成功");
        }else{
            System.out.println("修改失败");
        }
        //释放资源
        conn.close();
        stmt.close();

    }
}
